// @Author EthanScriptOn
// @Desc
package extend_param_collector

import (
	"context"
	"time"
)

type RedisQueryParams struct {
	Param []string
	Ctx   context.Context
}

func (r *RedisQueryParams) IsValid() bool {
	if len(r.Param) == 0 {
		return false
	}
	for _, str := range r.Param {
		if str == "" {
			return false
		}
	}
	return true
}

type RedisExecParams struct {
	Param []*RedisExecParam
}

func (r *RedisExecParams) IsValid() bool {
	if len(r.Param) <= 0 {
		return false
	}
	for _, param := range r.Param {
		if !param.IsValid() {
			return false
		}
	}
	return true
}

type RedisExecParam struct {
	Ctx        context.Context
	Key        string
	Value      interface{}
	Expiration time.Duration
}

func (r *RedisExecParam) IsValid() bool {
	return r.Ctx != nil && r.Key != "" && r.Value != nil
}
